```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nginx 多站点配置指南 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero {
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
        }
        .code-block {
            background: #2d3748;
            border-left: 4px solid #4299e1;
        }
        .card {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .step-icon {
            width: 50px;
            height: 50px;
            background: #4299e1;
            color: white;
        }
        .dropdown-content {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease-out;
        }
        .dropdown-toggle:checked ~ .dropdown-content {
            max-height: 1000px;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl flex flex-col items-center">
            <div class="flex items-center mb-6">
                <i class="fas fa-server text-3xl mr-3 text-blue-300"></i>
                <span class="text-sm font-semibold tracking-wider text-blue-200">NGINX配置指南</span>
            </div>
            <h1 class="text-4xl md:text-5xl font-bold text-center mb-6 leading-tight">Nginx多站点(虚拟主机)配置</h1>
            <p class="text-xl text-center max-w-3xl text-blue-100 mb-10">在同一台服务器上优雅托管多个网站的完整指南</p>
            <div class="flex flex-wrap justify-center gap-4">
                <a href="#basic-concepts" class="px-6 py-3 bg-white text-blue-600 font-semibold rounded-lg hover:bg-blue-50 transition duration-300">
                    <i class="fas fa-lightbulb mr-2"></i>基础知识
                </a>
                <a href="#configuration-steps" class="px-6 py-3 bg-blue-600 text-white font-semibold rounded-lg hover:bg-blue-700 transition duration-300">
                    <i class="fas fa-cog mr-2"></i>配置步骤
                </a>
                <a href="#advanced-options" class="px-6 py-3 bg-white text-blue-600 font-semibold rounded-lg hover:bg-blue-50 transition duration-300">
                    <i class="fas fa-tools mr-2"></i>高级选项
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl py-12 px-4 md:px-0">
        <!-- Basic Concepts -->
        <section id="basic-concepts" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-3xl font-bold">虚拟主机的基本概念</h2>
            </div>
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="p-8">
                    <p class="text-lg mb-6">虚拟主机（Virtual Host）允许在同一台服务器上使用不同的域名（或 IP 地址）托管多个网站。Nginx 通过 <code class="bg-gray-100 px-2 py-1 rounded">server</code> 块来实现虚拟主机功能。</p>
                    
                    <div class="mermaid mb-8">
                        graph TD
                            A[Nginx服务器] --> B[虚拟主机1: demo1.com]
                            A --> C[虚拟主机2: demo2.com]
                            A --> D[默认主机]
                            B --> E[/var/www/demo1]
                            C --> F[/var/www/demo2]
                            D --> G[/var/www/default]
                    </div>
                    
                    <div class="bg-blue-50 border-l-4 border-blue-400 p-4 rounded-r-lg">
                        <div class="flex">
                            <div class="flex-shrink-0">
                                <i class="fas fa-info-circle text-blue-500 text-xl"></i>
                            </div>
                            <div class="ml-3">
                                <p class="text-sm text-blue-700">
                                    <strong>重要概念：</strong> 每个虚拟主机有独立的配置，可以指定不同的域名、根目录、日志文件等，实现真正的多站点隔离。
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Configuration Steps -->
        <section id="configuration-steps" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-3xl font-bold">配置步骤</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-8">
                <!-- Step 1 -->
                <div class="card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="step-icon rounded-full flex items-center justify-center mr-4">
                                <span class="text-xl font-bold">1</span>
                            </div>
                            <h3 class="text-xl font-bold">创建配置文件</h3>
                        </div>
                        <p class="text-gray-600 mb-4">在 <code class="bg-gray-100 px-1 py-0.5 rounded">/etc/nginx/sites-available/</code> 目录下为每个虚拟主机创建独立的配置文件。</p>
                        
                        <label for="dropdown1" class="flex items-center text-blue-600 cursor-pointer mb-2">
                            <input type="checkbox" id="dropdown1" class="dropdown-toggle hidden">
                            <span class="mr-2 font-medium">查看demo1.com配置示例</span>
                            <i class="fas fa-chevron-down text-xs transition-transform duration-300 dropdown-icon"></i>
                        </label>
                        <div class="dropdown-content">
                            <div class="code-block text-gray-200 p-4 rounded-lg mb-4 overflow-x-auto">
                                <pre>server {
    listen 80;
    server_name demo1.com www.demo1.com;

    root /var/www/demo1;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}</pre>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Step 2 -->
                <div class="card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="step-icon rounded-full flex items-center justify-center mr-4">
                                <span class="text-xl font-bold">2</span>
                            </div>
                            <h3 class="text-xl font-bold">启用虚拟主机</h3>
                        </div>
                        <p class="text-gray-600 mb-4">创建符号链接将配置文件从 <code class="bg-gray-100 px-1 py-0.5 rounded">sites-available</code> 链接到 <code class="bg-gray-100 px-1 py-0.5 rounded">sites-enabled</code> 目录。</p>
                        
                        <div class="code-block text-gray-200 p-4 rounded-lg mb-4 overflow-x-auto">
                            <pre>sudo ln -s /etc/nginx/sites-available/demo1 /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/demo2 /etc/nginx/sites-enabled/</pre>
                        </div>
                    </div>
                </div>
                
                <!-- Step 3 -->
                <div class="card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="step-icon rounded-full flex items-center justify-center mr-4">
                                <span class="text-xl font-bold">3</span>
                            </div>
                            <h3 class="text-xl font-bold">创建网站根目录</h3>
                        </div>
                        <p class="text-gray-600 mb-4">为每个站点创建相应的根目录并放置 <code class="bg-gray-100 px-1 py-0.5 rounded">index.html</code> 文件。</p>
                        
                        <div class="code-block text-gray-200 p-4 rounded-lg mb-4 overflow-x-auto">
                            <pre>sudo mkdir -p /var/www/demo1
sudo mkdir -p /var/www/demo2

echo "&lt;h1&gt;Welcome to demo1&lt;/h1&gt;" | sudo tee /var/www/demo1/index.html
echo "&lt;h1&gt;Welcome to demo2&lt;/h1&gt;" | sudo tee /var/www/demo2/index.html</pre>
                        </div>
                    </div>
                </div>
                
                <!-- Step 4 -->
                <div class="card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="step-icon rounded-full flex items-center justify-center mr-4">
                                <span class="text-xl font-bold">4</span>
                            </div>
                            <h3 class="text-xl font-bold">测试并重载配置</h3>
                        </div>
                        <p class="text-gray-600 mb-4">测试配置文件并重新加载Nginx使配置生效。</p>
                        
                        <div class="code-block text-gray-200 p-4 rounded-lg mb-4 overflow-x-auto">
                            <pre>sudo nginx -t
sudo systemctl reload nginx</pre>
                        </div>
                        
                        <div class="bg-green-50 border-l-4 border-green-400 p-4 rounded-r-lg">
                            <div class="flex">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-check-circle text-green-500 text-xl"></i>
                                </div>
                                <div class="ml-3">
                                    <p class="text-sm text-green-700">
                                        如果一切顺利，您现在可以通过不同的域名访问各自的站点了！
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Advanced Options -->
        <section id="advanced-options" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-3xl font-bold">其他配置选项</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <!-- SSL/TLS -->
                <div class="card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <i class="fas fa-lock text-blue-500 text-2xl mr-3"></i>
                            <h3 class="text-xl font-bold">SSL/TLS 配置</h3>
                        </div>
                        <p class="text-gray-600 mb-4">为虚拟主机配置HTTPS加密连接，提升安全性。</p>
                        
                        <label for="dropdown2" class="flex items-center text-blue-600 cursor-pointer mb-2">
                            <input type="checkbox" id="dropdown2" class="dropdown-toggle hidden">
                            <span class="mr-2 font-medium">查看HTTPS配置示例</span>
                            <i class="fas fa-chevron-down text-xs transition-transform duration-300 dropdown-icon"></i>
                        </label>
                        <div class="dropdown-content">
                            <div class="code-block text-gray-200 p-4 rounded-lg mb-4 overflow-x-auto">
                                <pre>server {
    listen 443 ssl;
    server_name demo1.com www.demo1.com;

    ssl_certificate /etc/ssl/certs/demo1.crt;
    ssl_certificate_key /etc/ssl/private/demo1.key;

    root /var/www/demo1;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}</pre>
                            </div>
                        </div>
                        
                        <div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 rounded-r-lg">
                            <div class="flex">
                                <div class="flex-shrink-0">
                                    <i class="fas fa-exclamation-triangle text-yellow-500 text-xl"></i>
                                </div>
                                <div class="ml-3">
                                    <p class="text-sm text-yellow-700">
                                        <strong>注意：</strong> 需要获取有效的SSL证书，可以使用Let's Encrypt等免费证书颁发机构。
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Default Site -->
                <div class="card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <i class="fas fa-home text-blue-500 text-2xl mr-3"></i>
                            <h3 class="text-xl font-bold">默认站点配置</h3>
                        </div>
                        <p class="text-gray-600 mb-4">配置默认站点处理未匹配到其他虚拟主机的请求。</p>
                        
                        <div class="code-block text-gray-200 p-4 rounded-lg mb-4 overflow-x-auto">
                            <pre>server {
    listen 80 default_server;
    server_name _;

    root /var/www/default;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}</pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Tips & Tricks -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="p-8">
                    <h3 class="text-2xl font-bold mb-6 flex items-center">
                        <i class="fas fa-lightbulb text-yellow-500 mr-3"></i>
                        Nginx配置小贴士
                    </h3>
                    
                    <div class="grid md:grid-cols-2 gap-6">
                        <div class="flex items-start">
                            <div class="flex-shrink-0">
                                <div class="flex items-center justify-center h-10 w-10 rounded-md bg-blue-500 text-white">
                                    <i class="fas fa-search"></i>
                                </div>
                            </div>
                            <div class="ml-4">
                                <h4 class="text-lg font-medium">配置检查</h4>
                                <p class="mt-1 text-gray-600">
                                    在修改配置后，务必运行 <code class="bg-gray-100 px-1 py-0.5 rounded">sudo nginx -t</code> 测试配置语法，避免因配置错误导致服务无法启动。
                                </p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="flex-shrink-0">
                                <div class="flex items-center justify-center h-10 w-10 rounded-md bg-green-500 text-white">
                                    <i class="fas fa-sync-alt"></i>
                                </div>
                            </div>
                            <div class="ml-4">
                                <h4 class="text-lg font-medium">平滑重载</h4>
                                <p class="mt-1 text-gray-600">
                                    使用 <code class="bg-gray-100 px-1 py-0.5 rounded">sudo systemctl reload nginx</code> 可以平滑重载配置，不会中断现有连接。
                                </p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="flex-shrink-0">
                                <div class="flex items-center justify-center h-10 w-10 rounded-md bg-purple-500 text-white">
                                    <i class="fas fa-file-alt"></i>
                                </div>
                            </div>
                            <div class="ml-4">
                                <h4 class="text-lg font-medium">日志文件</h4>
                                <p class="mt-1 text-gray-600">
                                    每个虚拟主机可以配置独立的访问日志和错误日志，便于问题排查。
                                </p>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="flex-shrink-0">
                                <div class="flex items-center justify-center h-10 w-10 rounded-md bg-red-500 text-white">
                                    <i class="fas fa-shield-alt"></i>
                                </div>
                            </div>
                            <div class="ml-4">
                                <h4 class="text-lg font-medium">安全建议</h4>
                                <p class="mt-1 text-gray-600">
                                    限制对敏感文件的访问，如 <code class="bg-gray-100 px-1 py-0.5 rounded">.htaccess</code> 和 <code class="bg-gray-100 px-1 py-0.5 rounded">.git</code> 目录。
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col items-center">
                <div class="mb-6">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">分享实用技术，探索编程之美</p>
                </div>
                <div class="flex space-x-6">
                    <a href="http://www.yuque.com/jtostring" target="_blank" class="text-gray-400 hover:text-white transition-colors duration-300">
                        <i class="fas fa-globe mr-1"></i> 语雀主页
                    </a>
                </div>
                <div class="mt-8 text-sm text-gray-500">
                    &copy; 2023 技术小馆. All rights reserved.
                </div>
            </div>
        </div>
    </footer>

    <script>
        // 初始化Mermaid图表
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 下拉切换功能
        document.querySelectorAll('.dropdown-toggle').forEach(toggle => {
            toggle.addEventListener('change', function() {
                const icon = this.parentElement.querySelector('.dropdown-icon');
                const content = this.parentElement.nextElementSibling;
                
                if (this.checked) {
                    icon.style.transform = 'rotate(180deg)';
                } else {
                    icon.style.transform = 'rotate(0deg)';
                }
            });
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```